package cn.nexd.utils;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import cn.nexd.utils.framework.tools.SDCardUtil;

/**
 * Created by wangxu on 16/12/27.
 */
public class SDCardActivity extends AppCompatActivity {


    TextView textView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sdcard);
        textView = (TextView) findViewById(R.id.text);
    }


    public void getSDCardPath(View view) {
        textView.setText(SDCardUtil.getSDCardPath());
    }

    public void isAvailable(View view) {
        if (SDCardUtil.isAvailable()) {
            textView.setText("SDCard 可用");
        } else {
            textView.setText("SDCard 不可用");
        }
    }

    public void getAvailableBlock(View view) {
        String[] result = SDCardUtil.getAvailableBlocks(SDCardUtil.getSDCardPath());

        textView.setText("" + result[0] + " _" + result[1]);
    }


    public void getBlockCount(View view) {
        String[] result = SDCardUtil.getBlockCount(SDCardUtil.getSDCardPath());

        textView.setText("" + result[0] + " _" + result[1]);
    }
}
